package com.ctgu.B.B2.condition;

import com.github.oxo42.stateless4j.delegates.FuncBoolean;

/**
 * @author xiaozhiyong03@gmail.com
 * @data 2024/11/02 周六 14:49:20.94
 */
public class PasswordCondition {
    private static Integer passwordLength = 0;
    private static Integer count = 0;
    private static Boolean passwordIsCorrect = false;

    public static Integer getCount() {
        return count;
    }

    public static void setCount(Integer count) {
        PasswordCondition.count = count;
    }

    public static Boolean getPasswordIsCorrect() {
        return passwordIsCorrect;
    }

    public static void setPasswordIsCorrect(Boolean passwordIsCorrect) {
        PasswordCondition.passwordIsCorrect = passwordIsCorrect;
    }

    public static Integer getPasswordLength() {
        return passwordLength;
    }

    public static void setPasswordLength(Integer passwordLength) {
        PasswordCondition.passwordLength = passwordLength;
    }

    public FuncBoolean isMeetTheConditions() {
        return () -> passwordLength == 4;
    }

    public FuncBoolean isNotMeetTheConditions() {
        return () -> passwordLength != 4;
    }

    public FuncBoolean isCorrectPassword() {
        return () -> passwordIsCorrect;
    }

    public FuncBoolean isLock() {
        return () -> count >= 3;
    }
    public FuncBoolean isNotLock() {
        return () -> !(count >= 3);
    }

}
